/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package kimo.persistence.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author a381u296
 */
@Entity
@Table(name = "unit_location_type")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "UnitLocationType.findAll", query = "SELECT u FROM UnitLocationType u"),
    @NamedQuery(name = "UnitLocationType.findByUnitLocationTypeId", query = "SELECT u FROM UnitLocationType u WHERE u.unitLocationTypeId = :unitLocationTypeId"),
    @NamedQuery(name = "UnitLocationType.findByUnitLocationTypeName", query = "SELECT u FROM UnitLocationType u WHERE u.unitLocationTypeName = :unitLocationTypeName")})
public class UnitLocationType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "unit_location_type_id")
    private Integer unitLocationTypeId;
    @Basic(optional = false)
    @Column(name = "unit_location_type_name")
    private String unitLocationTypeName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "producerUnitLocationTypeId")
    private List<Producer> producerList;

    public UnitLocationType() {
    }

    public UnitLocationType(Integer unitLocationTypeId) {
        this.unitLocationTypeId = unitLocationTypeId;
    }

    public UnitLocationType(Integer unitLocationTypeId, String unitLocationTypeName) {
        this.unitLocationTypeId = unitLocationTypeId;
        this.unitLocationTypeName = unitLocationTypeName;
    }

    public Integer getUnitLocationTypeId() {
        return unitLocationTypeId;
    }

    public void setUnitLocationTypeId(Integer unitLocationTypeId) {
        this.unitLocationTypeId = unitLocationTypeId;
    }

    public String getUnitLocationTypeName() {
        return unitLocationTypeName;
    }

    public void setUnitLocationTypeName(String unitLocationTypeName) {
        this.unitLocationTypeName = unitLocationTypeName;
    }

    @XmlTransient
    public List<Producer> getProducerList() {
        return producerList;
    }

    public void setProducerList(List<Producer> producerList) {
        this.producerList = producerList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (unitLocationTypeId != null ? unitLocationTypeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UnitLocationType)) {
            return false;
        }
        UnitLocationType other = (UnitLocationType) object;
        if ((this.unitLocationTypeId == null && other.unitLocationTypeId != null) || (this.unitLocationTypeId != null && !this.unitLocationTypeId.equals(other.unitLocationTypeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return unitLocationTypeName;
    }
    
}
